imonit_client
in package
This is the implementation of the client-side class to use the i-mon-it micro services.
In order to use the services you would simply call the required static functions. And in order to provide the state static methods with information about your particular web application you would instantiate the imonit_client class, in order to retrieve that identification information of your web application within the imonit eco system. In order to do so you would use the following lines of code: $client = new imonit_client(); $token = $client->gettokenid(); $aktion = 'Your action'; const version = 'nn.nn.nnn dd.mm.yyyy'; $startid = imonit_clients::startpage($token, file,line,$paid, $aktion,version); Yourcode $midid = imonit_client::midpage($token,$startid, file,line,$paid, $ktion,version); $endid = imonit_client::endPage($token,$startid, file,line,$paid, $ktion,version);
If you use i-mon-it to optimize your core Webapplication, then you would use the methods 'start', 'mid' and 'end'. The usage of those three methods is pretty much the same as the one for monitoring your pages. The start method creates with the return value startid the reference points for the other two methods would you meant to be used within a method (mid) or at the end of your message typically right before you give back the results of your method. version 00.01.168 17.10.2025 minor Error correction with getting the download of the toke. It was a typo.
Tags
Table of Contents
Constants
- version = '00.01.182 02.01.2026'
- This constant is holding the current version and the date of the last change.
Properties
- $customernumber : int
- This is representing the customer number token belongs to
- $hash : string
- This string holds the hash value used for identification and verification of the token at the central i-mon-it Service.
- $isvalid : bool
- This is the indicator holding information whether the token found and loaded is valid or not.
- $nextupdate : DateTime
- This is the date: when when the token file requires an update from the i-mon-itserver
- $token : string
- This is the name of the local token found in the root directory on the Web server
- $tokenfilename : string
- Name of the token file loaded into the class.
- $tokenid : int
- Holds is a unique identifier of the token within the i-mon-it ecosystem.
- $tokenversion : string
- Version of the token which was loaded into the current instance of the class.
- $useragent : string
- String of the user agent from the browser as it is recorded by the Web server.
- $websidename : string
- Name of the website associated with the token
- $websiteid : int
- This is the id of the wbsite, which is mnitored by the service.
Methods
- __construct() : mixed
- This is a constructor used to instanciate the class.
- __destruct() : mixed
- This destructor method is cleaning up the memory consumed by the instance of the imonit_clirent instance.
- end() : int
- This static function as a recording the endpoint of the method you are tracking by the i-mon-it service.
- endPage() : int
- This static method is used to properly track the endpoint of your webpage and instruct the i-mon-it service to insert and page record into the data mart.
- getcustomernumber() : int
- This method return the i-mon-it customer mumber the token belongs to as stored in the Token.
- gettokenid() : int
- This method is returning the token ID of your website provided by i-mon-it
- gettokeninfo() : string
- Returns an HTML table with information of the various attributes and their values of this token.
- gettokenname() : string
- This method simply returns the name of the token of that website loaded from the tokenfile as it has to be stored on the website.
- gettokenversion() : string
- Returns the token API version, which is token is created by.
- getwebsiteid() : int
- This method returns the number of the Website fromthe token.
- isvalid() : bool
- This method is returning a bullion flak whether or not the client instance and the corresponding token are valid.
- lastentry() : int
- This static method retrieves the last entry within the database regarding the current webappplication.
- mid() : int
- This method should be used in case your function is performing heavy-duty operations and he want to have more than just a start and end point of your method being captured and tracked by the i-mon-it service.
- midPage() : int
- This static method is used to properly track a midpoint of your webpage and instruct the i-mon-it service to insert and page record into the data mart.
- start() : int
- This static method is used the record the start of the execution of the method in your application.
- startPage() : int
- This is one of the main methods provided by the library its test the i-mon-it server to record the start of a page.
- ua() : int
- This micro service is retrieving the identifier number for the browser also known as user agent.
- updatetoken() : bool
- With this method the token file will be updated by the newest version of the token file coming from the central i-mon-it services.
- verifytoken() : bool
- This method checks back to the i-mon-it server, whether the token is developed
- version() : string
- This method is returning the version number of the client library including the date of last change
Constants
version
This constant is holding the current version and the date of the last change.
public
string
version
= '00.01.182 02.01.2026'
version and date of change Format:nn.nn.nnn dd.mm.yyyy
Properties
$customernumber
This is representing the customer number token belongs to
private
int
$customernumber
= -1
custom number of the token owner
Tags
$hash
This string holds the hash value used for identification and verification of the token at the central i-mon-it Service.
private
string
$hash
= ''
Hash value for the Token
Tags
$isvalid
This is the indicator holding information whether the token found and loaded is valid or not.
private
bool
$isvalid
= \false
Tags
$nextupdate
This is the date: when when the token file requires an update from the i-mon-itserver
private
DateTime
$nextupdate
Tags
$token
This is the name of the local token found in the root directory on the Web server
private
string
$token
= ''
name of the token found for this web application.
Tags
$tokenfilename
Name of the token file loaded into the class.
private
string
$tokenfilename
= ''
Name of the token file loaded into the class.
Tags
$tokenid
Holds is a unique identifier of the token within the i-mon-it ecosystem.
private
int
$tokenid
= -1
Tokenid within the i-mon-it ecosystem
Tags
$tokenversion
Version of the token which was loaded into the current instance of the class.
private
string
$tokenversion
= ''
version Of the token declaration loaded into the instance of the class.
Tags
$useragent
String of the user agent from the browser as it is recorded by the Web server.
private
string
$useragent
= ''
User agent string as provided by the browser and the Web server.
$websidename
Name of the website associated with the token
private
string
$websidename
= ''
website associated with the token.
$websiteid
This is the id of the wbsite, which is mnitored by the service.
private
int
$websiteid
= -1
This number refer s the i-mon-it central database. It is set by the token.
Number of the website as named in the i-mon-it central service.
Tags
Methods
__construct()
This is a constructor used to instanciate the class.
public
__construct() : mixed
This constructor does not require any parameters to function. The constructor retrieves the necessary information regarding the webapplication from the token file which has to reside in the root directory of your web application and has to be named 'imonit.token'.
__destruct()
This destructor method is cleaning up the memory consumed by the instance of the imonit_clirent instance.
public
__destruct() : mixed
Even some of the library is programmed to only use very little memory resources it is a good practice to unset the client instance at the end of your webpage or your class using the imonit micro services.
end()
This static function as a recording the endpoint of the method you are tracking by the i-mon-it service.
public
static end(int $token, int $startid, string $fileorMethod, int $line, bool $paid, string $aktion, string $version) : int
Parameters
- $token : int
-
This is the number of your token of your website
- $startid : int
-
this is the i-mon-it service ID, which you got when you called the start service.
- $fileorMethod : string
-
This is the name of the class and method you're calling the i-mon-it service from. In the case of the end Service this is typically__MEWTHOD__.
- $line : int
-
This is line of code within your source code you according the end service from. The value used here is typically the PHP constant LINE.
- $paid : bool
-
This flag is indicating whether or not you consider this method in this tracking point part of the payload of your website.
- $aktion : string
- $version : string
Tags
Return values
int —Returns of the unique i-mon-it service ID provided by the central i-mon-it service.
endPage()
This static method is used to properly track the endpoint of your webpage and instruct the i-mon-it service to insert and page record into the data mart.
public
static endPage(int $token, int $startid, string $fileorMethod, int $line, bool $paid, string $aktion, string $version) : int
Parameters
- $token : int
-
This is the ID of the token, which is used to identify the website with the i-mon-it service.
- $startid : int
-
This is the ID provided by the i-mon-it service start page at the time you called the start page method from this library.
- $fileorMethod : string
-
Name of the file holding the webpage. The value is typically provided by the PHP constant FILE.
- $line : int
-
this is a line inside the source code from where you calling the end page action. as value you typically provides a PHP constant LINE.
- $paid : bool
-
Flag indicating whether you considering this page being part of the payload of your website.
- $aktion : string
-
This is the action that webpage has performed.
- $version : string
Return values
intgetcustomernumber()
This method return the i-mon-it customer mumber the token belongs to as stored in the Token.
public
getcustomernumber() : int
Return values
int —number of the customer;
gettokenid()
This method is returning the token ID of your website provided by i-mon-it
public
gettokenid() : int
Return values
int —ID of the token provided by i-mon-it
gettokeninfo()
Returns an HTML table with information of the various attributes and their values of this token.
public
gettokeninfo() : string
Return values
string —an HTML table containing information about the token used by this website
gettokenname()
This method simply returns the name of the token of that website loaded from the tokenfile as it has to be stored on the website.
public
gettokenname() : string
Tags
Return values
string —Name of the token used by this client website.
gettokenversion()
Returns the token API version, which is token is created by.
public
gettokenversion() : string
Tags
Return values
string —Version the token API
getwebsiteid()
This method returns the number of the Website fromthe token.
public
getwebsiteid() : int
return int: Websiteid as stored in the token.
Return values
intisvalid()
This method is returning a bullion flak whether or not the client instance and the corresponding token are valid.
public
isvalid() : bool
Return values
bool —Returns true in case the client instance is valid, false will be returned otherwise.
lastentry()
This static method retrieves the last entry within the database regarding the current webappplication.
public
static lastentry(string $fileorMethod, string $aktion) : int
Parameters
- $fileorMethod : string
-
Mane of the calling Method or file.
- $aktion : string
-
Name of the action that should be associated with this call.
Return values
int —Returns the number of the last entry in the i-mon-it database
mid()
This method should be used in case your function is performing heavy-duty operations and he want to have more than just a start and end point of your method being captured and tracked by the i-mon-it service.
public
static mid(int $token, int $startid, string $methodorfile, int $line, bool $paid, string $aktion, string $version) : int
Parameters
- $token : int
-
This is a number of the token of your website.
- $startid : int
-
This is the ID you did get when you call it the start i-mon-it service. Bypassing this on to the mixed tracking request and later to the end i-mon-it service. You can ensure that the i-mon-it service will correctly track your function flow over the overall course of the method execution
- $methodorfile : string
-
Here you should use the PHP constant__METHOD__ in order to capture the proper quotation of your class and the method for which you call this function.
- $line : int
-
This is the line of code of the method call. Typically that PHP constant LINE is used to document this.
- $paid : bool
-
Indicator whether you consider this method and part of your payload of your application.
- $aktion : string
-
This is a possibility to further differenciate the context in which this is called.
- $version : string
Tags
Return values
int —The method returns a unique ID from the i-mon-it tracking service.
midPage()
This static method is used to properly track a midpoint of your webpage and instruct the i-mon-it service to insert and page record into the data mart.
public
static midPage(int $token, int $startid, string $fileorMethod, int $line, bool $paid, string $aktion, string $version) : int
Parameters
- $token : int
-
This is the ID of the token, which is used to identify the website with the i-mon-it service.
- $startid : int
-
This is the ID provided by the i-mon-it service start page at the time you called the start page method from this library.
- $fileorMethod : string
-
Name of the file holding the webpage. The value is typically provided by the PHP constant FILE.
- $line : int
-
this is a line inside the source code from where you calling the end page action. as value you typically provides a PHP constant LINE.
- $paid : bool
-
Flag indicating whether you considering this page being part of the payload of your website.
- $aktion : string
-
This is the action that webpage has performed.
- $version : string
Return values
intstart()
This static method is used the record the start of the execution of the method in your application.
public
static start(int $token, string $fileorMethod, int $line, bool $paid, string $aktion, string $version) : int
Parameters
- $token : int
-
This is the number of the token of your website.
- $fileorMethod : string
-
This is the source file which you want a morning tour using the star service. Typically as the stock service is Used inside the core application you can use the PHP constant__METHOD__, which way you capture the complete identifier of your class.
- $line : int
-
This is the line of your source code, which is used to call the i-mon-it service. Typically you can use therefore the PHP constant LINE.
- $paid : bool
- $aktion : string
-
This is an option to specify even more the curent Action item an to diffferentuate the use of the function.
- $version : string
Tags
Return values
int —The method returns the unique ID by which the tracking request is captured within thei-mon-it service.
startPage()
This is one of the main methods provided by the library its test the i-mon-it server to record the start of a page.
public
static startPage(int $token, string $fileorMethod, int $line, bool $paid, string $aktion, string $version) : int
This is a static function, which can be used directly within your website.
Parameters
- $token : int
-
Number of your token.
- $fileorMethod : string
-
This is the reference to the calling page or class. When calling the method the typical PHP constants: METHOD or FILE is used to provide value for this call.
- $line : int
-
This is a reference to the line number within the source code from where the recording for the page should be started. This is typically you done by using the PHP constant__LINE__
- $paid : bool
-
this boolean value is indicating, whether you consider the calling webpage part of your payload. This value is impacting the reporting and the analysis of the i-mon-it offering.
- $aktion : string
-
Often and PHP projects one single webpage is implementing my typical functions in order to properly track the different functions this parameter can be used.
- $version : string
Tags
Return values
int —The call to the i-mon-it server will generate an unique ID, which should be stored and be provided as one of the parameters, when you call the metric and page method from the imonit_client library.
ua()
This micro service is retrieving the identifier number for the browser also known as user agent.
public
static ua(string $ua) : int
The method asks for the string to pass the user agent identifier to the method. This is an optional parameter as a method itself is using a standard function to retrieve the user agent directly. The method returns the number of the user agent as it is returned from the i-mon-it micro service.
Parameters
- $ua : string
-
This optional parameter should contain the three-ring which identifies the browser also known as useragent.
Tags
Return values
int —Key of the useragent as it is known in the i-mon-it ecosystem.
updatetoken()
With this method the token file will be updated by the newest version of the token file coming from the central i-mon-it services.
public
static updatetoken(int $token, string $fileorMethod, int $line, int $app, bool $paid, string $aktion, string $version) : bool
Parameters
- $token : int
- $fileorMethod : string
- $line : int
- $app : int
- $paid : bool
- $aktion : string
- $version : string
Return values
bool —Returns whether the updatewas a succes (true) or not (false)
verifytoken()
This method checks back to the i-mon-it server, whether the token is developed
public
verifytoken(string $token, string $hash) : bool
Parameters
- $token : string
- $hash : string
-
take the hash value as it is provided in the token file to check whether or not the token is valid.
Return values
bool —Returns a Boolean value whether the token is is valid or not.
version()
This method is returning the version number of the client library including the date of last change
public
static version() : string
Tags
Return values
string —string holding was number and the date of last change of this library ( format: nn.nn.nn dd.mm.yyyy)